#import "OasisVirtuousController.h"
        
#import "OasisVirtuousModel.h"
#import "OasisVirtuousCell.h"
#import "Masonry.h"

@interface OasisVirtuousController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) UITableView *xylophoneTableView;
@property (nonatomic, strong) NSMutableArray *radiantModels;

@end

@implementation OasisVirtuousController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    [super viewDidLoad];

    [self quaintInitui];
	[self melodicCirculatefetchData];
}


- (UITableView *)figHandleTableView {
    if (!_xylophoneTableView) {
        _xylophoneTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
        _xylophoneTableView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
        _xylophoneTableView.estimatedRowHeight = 0;
        _xylophoneTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _xylophoneTableView.contentInset = UIEdgeInsetsMake(16, 0, 16, 0);
        _xylophoneTableView.delegate = self;
        _xylophoneTableView.dataSource = self;
        _xylophoneTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
        _xylophoneTableView.showsVerticalScrollIndicator = NO;
        _xylophoneTableView.showsHorizontalScrollIndicator = NO;
        _xylophoneTableView.backgroundColor = UIColor.clearColor;
    }
    return _xylophoneTableView;
}

//: 初始化页面UI
- (void)quaintInitui {

	[self.view addSubview:self.xylophoneTableView];
	[self.xylophoneTableView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.leading.trailing.equalTo(self.view);
		make.top.equalTo(self.view);
		make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
	}];
}


//: 获取数据模型
- (void)melodicCirculatefetchData {
	
}

//: 懒加载数据模型数组
- (NSMutableArray *)radiantModels {
	if (!_radiantModels) {
		_radiantModels = [NSMutableArray array];
	}
	return _radiantModels;
}

#pragma mark - UITableView DataSource 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.radiantModels.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    OasisVirtuousCell *noodleNirvana = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([OasisVirtuousCell class])];
    if (noodleNirvana == nil) {
        noodleNirvana = [[OasisVirtuousCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:NSStringFromClass([OasisVirtuousCell class])];
    }
    noodleNirvana.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return noodleNirvana;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
	OasisVirtuousModel *odysseyDoodleXylophone = self.radiantModels[indexPath.row];
	return odysseyDoodleXylophone.xenonCellHeight;
}


#pragma mark - UITableView Delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // cell tap action
}


@end
